package com.uphone.kingmall.adapter;

import android.content.Context;
import android.widget.ImageView;
import android.widget.LinearLayout;

import com.blankj.utilcode.util.SizeUtils;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.china.zhuoyue.R;
import com.uphone.kingmall.app.MyApplication;
import com.uphone.kingmall.bean.ShopPhotoBean;
import com.uphone.kingmall.utils.GlideUtils;

/**
 * <pre>
 *     author : radish
 *     e-mail : 15703379121@163.com
 *     time   : 2019/3/18
 *     desc   :
 * </pre>
 */
public class ShopPhotoAdapter extends BaseQuickAdapter<ShopPhotoBean.DataBean, BaseViewHolder> {
    public ShopPhotoAdapter(Context context) {
        super(R.layout.kingmall_item_rv_shop_photo);
        this.mContext = context;
    }

    @Override
    protected void convert(BaseViewHolder helper, ShopPhotoBean.DataBean item) {
        ImageView ivItem = helper.getView(R.id.iv_item);
        LinearLayout.LayoutParams params = (LinearLayout.LayoutParams) ivItem.getLayoutParams();
        int width = (MyApplication.width - SizeUtils.dp2px(40)) /4;
        params.width = width;
        params.height = width;
        ivItem.setLayoutParams(params);
        GlideUtils.getInstance().loadCornerImage(mContext, item.getImg(), SizeUtils.dp2px(2), ivItem);
    }
}
